<include file="../Public/_header.html" />
<script  type="text/javascript" src="__PUBLIC__/Js/rcalendar.js" ></script>
<script type="text/javascript" src="__PUBLIC__/Js/jquery.form.js"></script>
<link href="__PUBLIC__/Css/goodDetail.css" rel="stylesheet" type="text/css">
<link href="__PUBLIC__/Js/editor/editor/theme/base-min.css" rel="stylesheet"/>
<!--[if lt IE 8]>
<link href="__PUBLIC__/Js/editor/editor/theme/cool/editor-pkg-min-mhtml.css" rel="stylesheet"/>
<![endif]-->
<!--[if gte IE 8]><!-->
<link href="__PUBLIC__/Js/editor/editor/theme/cool/editor-pkg-min-datauri.css" rel="stylesheet"/>
<!--<![endif]-->

<include file="../Public/editor.html" />

<div class="so_main">
	<php>if($type!='edit'){</php>
  		<div class="page_tit">录入商品</div>
  <php>}else{</php>
  		<include file="../Admin/Tpl/default/Goods/top_box.html" />
  <php>}</php>
  <style>
  	.form2 dl{
  		float: left;
    	width: 50%;
    }
  </style>
  <div class="form2" id="main_area">
  	<form method="post" 
  		<php>if($type!='edit'){</php>
  				action="{:U('/Goods/doAddGood')}" 
		  <php>}else{</php>
		  		action="{:U('/Goods/doEditGood')}" 
		  <php>}</php>
  				enctype="multipart/form-data">
  	<input name="id" type="hidden" value="{$good.id}">
  		<div class="clear"></div>
	   	<dl class="lineD" style="font-weight:bold;height:40px;">
	   		<php>if($type=='edit'){</php>
			  		<dt>基本信息  当前图片：</dt>
				<dd>
					<div>
						<img width="30px" height="30px"
							<php>if($type == 'edit'){</php>  
								src="{:getAttachUrl($good['goods_icon'])}"
							<php>}</php> 
						>
				
					</div>
				</dd>
			  <php>}else{</php>
			  		<dt>基本信息：</dt>
				<dd>
				</dd>
			  <php>}</php>
	      
	    </dl>
	    <dl class="lineD" style="height:40px;">
				<dt style="color:red;margin-top: 8px;">是否生效：</dt>
				<dd style="margin-top: 5px;">
					<span>
						<input name="enable" type="checkbox" 
							<php>if($good['enable'] == 'Y') {</php> checked = "checked" <php>}</php> 
							value="Y">
						钩选为生效
					</span>
				</dd>
			</dl>
			<div class="clear"></div>
	    <dl class="lineD">
	      <dt>商品名称：</dt>
	      <dd>
	        <input name="title" type="text" value="{$good.title}">
	      </dd>
	    </dl>
	    
	    <dl class="lineD">
	      <dt>兑换方式：</dt>
	      <dd>
	      	<select name="get_type">
	      		<option value="self" <php>if(empty($good['get_type'])||$good['get_type']=='self'){</php>selected<php>}</php>>自取礼品</option>
	      		<option value="delivery" <php>if(!empty($good['get_type'])&&$good['get_type']=='delivery'){</php>selected<php>}</php>>快递礼品</option>
	      		<option value="all" <php>if(!empty($good['get_type'])&&$good['get_type']=='all'){</php>selected<php>}</php>>自取礼品，快递礼品</option>
	      	</select>
	      </dd>
    	</dl>
    
	    <dl class="lineD">
				<dt>商品分类：</dt>
				<dd>
		      	<input id="sortdesc" type="text" value="{$good['sort_id']|getCategoryName}" 
		      					onclick="ui.box.load(
		    											'{:U('Index://Public/showtree',array('code'=>'goods'))}'
		    											,{ title:'查看商品分类' })"
		      					readonly>
		      	<input id="sort_id" name="sort_id" type="hidden" value="{$good['sort_id']}">
					<script>
							function _tmp_setselectdict(rel,txt){
					    		$('#sortdesc').val(txt);
					    		$('#sort_id').val(rel);
					    }
				</script>
				</dd>
			</dl>
    
    
    
		<dl class="lineD">
	      <dt>供应商户：</dt>
	      <dd>
	      	<input id="partnerdesc" type="text" value="{:getParnterTitle($good['partner_id'])}" 
						        onclick="k_pop_syncSearch('partner_id'
						        													,'partnerdesc'
						        													,'选择商户'
						        													,'{:U('Admin://Partner/getJson')}'
						        													,null
						        													,null)" 
						        readonly >
					<input name="partner_id" id="partner_id" type="hidden" value="{$good['partner_id']}">  
	      </dd>
	  	</dl>

	    <dl class="lineD">
	      <dt>开始日期：</dt>
	      <dd>
	        <input name="start_time" type="text"
							class="input_text"
							value="{:paramMillisecond2Date($good['start_time'],'Y-m-d h:i:s', date('Y-m-d',time()) )}"
					        onfocus="rcalendar(this,'full');" readonly />
	      </dd>
		</dl>

    <dl class="lineD">
      <dt>截止日期：</dt>
      <dd>
        <input name="expire_time" type="text"
			class="input_text"
			value="{:paramMillisecond2Date($good['expire_time'],'Y-m-d h:i:s', date('Y-m-d',time()) )}"
			onfocus="rcalendar(this,'full');" readonly />
      </dd>
    </dl>
    
    <div class="clear"></div>
    <dl class="lineD" style="width:100%">
				<dt>商品概要：</dt>
				<dd>
					<input name="summary" type="text" value="{$good.summary}" style="width:450px">
				</dd>
	</dl>
	
	<div class="clear"></div>
    <dl class="">
      <dt>商品详细：</dt>
      <dd>
	      <textarea name="detail" id="detail" style="width:650px;height:200px">{:$good['detail']}</textarea>
				<p>此处编辑商品的详细说明，包括图片等，用于在产品页的显示。
					<span onclick="alert(1);
									var _editor_oldcontent;
									_editor_oldcontent=$('#ke-editor-body',document.frames('kissy-editor').document).html();
									//_editor_oldcontent=$(window.frames['kissy-editor'].document).find('#ke-editor-body').html();
									alert(_editor_oldcontent+$('#detail_template').html());
									$('#kissy-editor').contents().find('#ke-editor-body').html() ;
									alert(_editor_oldcontent);
									//alert(_editor_oldcontent+$('#detail_template').html());
									">点击获得模板代码</span>
				</p>
		  </dd>
    </dl>

    <div class="clear"></div>
    
    
    <div class="page_btm" style="padding: 18px 0 18px 0;text-align: center;">
      <input type="submit" class="btn_b" value="提交" />
    </div>
    </form>
  </div>
	<div id="detail_template" style="display:none;">
		<div class="intro_box">
			<div class="introbar"><span class="i_b1">标题</span></div>
			<div class="intro"><p>内容</p></div>
		</div>
	</div>
</div>
<script>
$(document).ready(function(){
	
	loadEditor("detail");
});
</script>
<include file="../Public/_footer.html" />